package com.woniu.common;

public class Result<T> {
    private String msg;
    private int code;
    private T data;

    public Result(T data) {
    }

    public String getMsg(){
        return this.msg;
    }
    public  int getCode(){
        return this.code;
    }
    public void setMsg(String msg) {
        this.msg = msg;
    }
    public void setCode(int code) {
        this.code = code;
    }
    public void setData(T data) {
        this.data = data;
    }
    public Result(){

    }
    public  Result(int code, String msg, T data){
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static Result success() {
        Result resObj = new Result();
        resObj.setCode(200);
        resObj.setMsg("成功了");

        return resObj;

    }
    public static <T> Result<T> success(T data){
        Result<T> result = new Result<T>(data);
        result.setMsg("成功");
        result.setCode(200);
        return result;
    }
}
